
const nodemailer = require('nodemailer');
// const smtpTransport = require('nodemailer-smtp-transport');

const config = require('../config');

nodemailer.createTestAccount((err, account) => {
  console.log(account)
let transport = nodemailer.createTransport({
    host: 'smtp.163.com',
    port: 25,
    secure: false,
    auth: {
      user: 'zzu_laboratory@163.com',
      pass: 'zzu123456'
    },
    logger: true,
    debug: true
  }, { from: 'jufan <zzu_laboratory@163.com>' });   //发送邮件的相关参数

let mail = {
  to: ['lian@jufantech.com'],
  subject: '测试',
  text: `
          # git pull
          ${config.password}
          ----------------
          git pull stderr:
          ${config.license}
          ----------------
          commit:
          ${JSON.stringify(config, null, 2)}`
};

transport.sendMail(mail, (error, message) => {
  if (error){
    console.log(error);
  }else{
    console.log('message: ', message);
  }
  transport.close();
})
});